from typing import Literal

from langchain.chat_models import init_chat_model
from pydantic import BaseModel, Field


class Keywords(BaseModel):
    keywords: list[str] = Field(default_factory=list, description=(
        "several specific, distinct keywords that capture key concepts and terminology."
        "Order from most to least important."
        "Don't include keywords that are the name of the speaker or time."
        "At least three keywords, but don't be too redundant."
    ))

class Answer(BaseModel):
    answer: str = Field(default="", description=(
        "the answer of the question."
    ))

class QA_Evaluation(BaseModel):
    llm_answer: str = Field(default="")
    real_answer: str = Field(default="")
    category: Literal[1, 2, 3, 4, 5]


llm = init_chat_model("deepseek:deepseek-chat")
generate_keywords_llm = llm.with_structured_output(Keywords)
answer_llm = llm.with_structured_output(Answer)

